package com.sx.art2.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sx.art2.beans.Category;
import com.sx.art2.mapper.CategoryMapper;
import com.sx.art2.service.CategoryService;
@Service
public class CategoryServiceImpl implements CategoryService {

	@Autowired
	CategoryMapper categoryMapper;
	@Override
	public void insert(Category category) {
		// TODO 自动生成的方法存根
		categoryMapper.insert(category);
	}
	
	@Override
	public void delete(int categoryId) {
		// TODO 自动生成的方法存根
		categoryMapper.delete(categoryId);
	}
	@Override
	public void update(Category category) {
		// TODO 自动生成的方法存根
		categoryMapper.update(category);
		
	}
	@Override
	public Category selectById(int categoryId) {
		// TODO 自动生成的方法存根
		Category c= categoryMapper.selectById(categoryId);
		System.out.println(c.getCategoryId());
		return c;
	}
	@Override
	public List<Category> list() {
		// TODO 自动生成的方法存根
		return categoryMapper.list();
	}

	@Override
	public int selectByName(String categoryName) {
		// TODO Auto-generated method stub
		Category c=categoryMapper.selectByName(categoryName);
		return c.getCategoryId();
	}
	

	
}
